package utilities;

import java.util.ArrayList;

public class MathUtilities {
	public static int givePercent( int anteil, int gesamt ) {
		if( anteil == 0 ) {
			return 0;
		}
		if ( gesamt > 0 ) {
			return   ( anteil * 100 / gesamt  );
		} else {
			return 100;
			
		}
	}
	public static int giveAverage( ArrayList<Integer> list ) {
		int average = -1;
		int total = 0;
		for( int entry : list ) {
			total += entry;
		}
		average = total / list.size();
		
		return average;
	}
}
